package domain;

public class Unit {
	
	private Dice roll;
	
	private String name;
	private int strength, dexterity, wisdom, constitution;
	
	private int maxHealth, currentHealth;
	private int initiative;
	private int armorClass;
	
	private final int baseAC = 10;
	private final int baseHP = 20;
	
	public Unit(String name, int strength, int dexterity, int wisdom, int constitution) {
		super();
		
		roll = new Dice();
		
		this.setName(name);
		
		this.setStrength(strength);
		this.setDexterity(dexterity);
		this.setWisdom(wisdom);
		this.setConstitution(constitution);
		
		this.setMaxHealth(baseHP + roll.getMod(getConstitution()));	
		this.setCurrentHealth(this.getMaxHealth());
		this.setArmorClass(baseAC + roll.getMod(getDexterity()));
	}
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getStrength() {
		return strength;
	}

	public void setStrength(int strength) {
		this.strength = strength;
	}

	public int getDexterity() {
		return dexterity;
	}

	public void setDexterity(int dexterity) {
		this.dexterity = dexterity;
	}

	public int getWisdom() {
		return wisdom;
	}

	public void setWisdom(int wisdom) {
		this.wisdom = wisdom;
	}

	public int getConstitution() {
		return constitution;
	}

	public void setConstitution(int constitution) {
		this.constitution = constitution;
	}

	public int getMaxHealth() {
		return maxHealth;
	}

	public void setMaxHealth(int maxHealth) {
		this.maxHealth = maxHealth;
	}

	public int getCurrentHealth() {
		return currentHealth;
	}

	public void setCurrentHealth(int currentHealth) {
		this.currentHealth = currentHealth;
		if(currentHealth > getMaxHealth())
			this.currentHealth = getMaxHealth();
	}

	public int getInitiative() {
		return initiative;
	}

	public void setInitiative(int initiative) {
		this.initiative = initiative;
	}

	public int getArmorClass() {
		return armorClass;
	}

	public void setArmorClass(int armorClass) {
		this.armorClass = armorClass;
	}

}
